<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 获取数组交集
    const intersection = (list, ...args) => list.filter(item => args.every(list => list.includes(item)))
    console.log(intersection([1, 2], [2, 3])); // [2]
    console.log(intersection([1, 2], [3, 4])); // []
  </script>
</body>

</html>